//
// Created by Semir on 2020/3/27.
//

#include <iostream>
#include <deque>
#include <cstring>
#include <iomanip>
#include <cstdio>

using namespace std;

const int MAX_LEN = 400;

int matrix[MAX_LEN][MAX_LEN];
int n;
int m;
int startX;
int startY;
int dirX[8] = {-1, -2, -2, -1, 1, 2, 2, 1};
int dirY[8] = {2, 1, -1, -2, 2, 1, -1, -2};

void bfsMark() {
    matrix[startX][startY] = 0;
    deque<int> queueX;
    deque<int> queueY;
    queueX.push_back(startX);
    queueY.push_back(startY);
    while (!queueX.empty() && !queueY.empty()) {
        int x = queueX.front();
        int y = queueY.front();
        queueX.pop_front();
        queueY.pop_front();
        for (int i = 0; i < 8; i++) {
            int dx = x + dirX[i];
            int dy = y + dirY[i];
            if (dx >= 0 && dx < n && dy >= 0 && dy < m && matrix[dx][dy] < 0) {
                queueX.push_back(dx);
                queueY.push_back(dy);
                matrix[dx][dy] = matrix[x][y] + 1;
            }
        }
    }
}

int main() {
    cin >> n >> m >> startX >> startY;
    startX--;
    startY--;
    for (int i = 0; i < n; i++) {
        memset(matrix[i], -1, sizeof(matrix[i]));
    }
    bfsMark();
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
//            cout << setiosflags(ios::left) << setw(5) << matrix[i][j] << " ";
            printf("%-5d", matrix[i][j]);
        }
        cout << endl;
    }
    return 0;
}


